home *** CD-ROM | disk | FTP | other *** search
/ Ian & Stuart's Australian Mac 1993 September / September 93.iso / Archives / Fun, Tricks & Hacks / Mr. Potatohead / Potato Scripts < prev   
Text File  |  1987-10-02  |  7KB  |  244 lines

  1. SCRIPTS FOR STACK: Mr. Potatohead
  2. ======================================================
  3.  
  4. ** STACK SCRIPT ************************************
  5. on openStack
  6.   hide menuBar
  7.   hide message
  8.   send "newGame" to bkgnd 1
  9. end openStack
  10.  
  11. on closeStack
  12.   show menuBar
  13. end closeStack
  14.  
  15. ** BACKGROUND #1: Potato ************************************
  16.  
  17. on mouseDown
  18.   global thePart
  19.   
  20.   -- This stuff makes each button follow the mouse when it is the
  21.   -- current face part, as determined by the die roll.  It shows up
  22.   -- here just once, instead of being duplicated in each button.
  23.   
  24.   if the short name of the target = thePart then
  25.     repeat while the mouse is down
  26.       show bkgnd button thePart at the mouseloc
  27.     end repeat
  28.   end if
  29. end mouseDown
  30.  
  31. on mouseUp
  32.   global partsVisible,counter
  33.   if partsVisible = 6 then
  34.     put "You Win!" into line 1 of bkgnd field "youWin!"
  35.     put counter && "rolls" into line 2 of bkgnd field "youWin!"
  36.     if counter < 7 then
  37.       put "Awesome!" into line 3 of bkgnd field "youWin!"
  38.     else
  39.       if counter < 10 then
  40.         put "Good game!" into line 3 of bkgnd field "youWin!"
  41.       else
  42.         if counter < 15 then
  43.           put "Pretty Good" into line 3 of bkgnd field youWin!
  44.         else
  45.           if counter < 25 then
  46.             put "not too good" into line 3 of bkgnd field "youWin!"
  47.           else
  48.             put "work at it" into line 3 of bkgnd field "youWin!"
  49.           end if
  50.         end if
  51.       end if
  52.     end if
  53.     show bkgnd field "youWin!"
  54.   end if
  55. end mouseUp
  56.  
  57. on newGame
  58.   
  59.   -- Sent by either the openStack handler or bkgnd button, "newGame"
  60.   global counter,partsVisible
  61.   put zero into counter
  62.   put zero into partsVisible
  63.   hide bkgnd button "mouth"
  64.   hide bkgnd button "nose"
  65.   hide bkgnd button "leftEye"
  66.   hide bkgnd button "leftEar"
  67.   hide bkgnd button "rightEye"
  68.   hide bkgnd button "rightEar"
  69.   repeat until the mouseClick
  70.     set hilite of bkgnd button "Click Me for Luck" to true
  71.     set hilite of bkgnd button "Click Me for Luck" to false
  72.   end repeat
  73.   set hilite of bkgnd button "Click Me for Luck" to false
  74. end newGame
  75.  
  76. on whichPart
  77.   -- This script was the first generation attempt.  It created a new
  78.   -- button every time the die was "rolled", set its properties, in-
  79.   -- cluding loading its script, and then showing it.  Pretty soon
  80.   -- the stack was loaded with buttons.  Not good.
  81.   -- This all works, but is not necessary.  Much better to just recycle
  82.   -- the same buttons.
  83.   global thePart
  84.   set lockscreen to true
  85.   set editbkgnd to true
  86.   doMenu New button
  87.   set editbkgnd to false
  88.   hide bkgnd button "new button"
  89.   set name of bkgnd button "new button" to thePart
  90.   set showName of bkgnd button thePart to false
  91.   set style of bkgnd button thePart to transparent
  92.   set icon of bkgnd button thePart to thePart
  93.   show bkgnd button thePart at 215,269
  94.   choose browse tool
  95.   set the script of bkgnd button thePart to ¬
  96.   "on mouseDown" & return ¬
  97.   & "global thePart" & return ¬
  98.   & "set hilite of bkgnd button thePart to true" & return ¬
  99.   & "repeat while the mouse is down" & return ¬
  100.   & "show bkgnd button thePart at the mouseloc" & return ¬
  101.   & "end repeat" & return ¬
  102.   & "set hilite of bkgnd button thePart to false" & return ¬
  103.   & "end mouseDown"
  104. end whichPart
  105.  
  106. on showPart
  107.   -- this is now part of the script for bkgnd button "Click Me for Luck"
  108.   global thePart
  109.   if the visible of bkgnd button thePart = false then
  110.     show bkgnd button thePart at 215,269
  111.   end if
  112. end showPart
  113.  
  114. ** BKGND #1, FIELD #2 ************************************
  115. on mouseUp
  116.   hide bkgnd field 2
  117. end mouseUp
  118.  
  119. ** BKGND #1, BUTTON #1: Click Me for Luck ************************************
  120. on mouseUp
  121.   global thePart, counter, partsVisible
  122.   add 1 to counter
  123.   repeat 15 times
  124.     go to any card of this background
  125.   end repeat
  126.   get the short name of this card
  127.   put first word of it into thePart
  128.   if the visible of bkgnd button thePart is false then
  129.     show bkgnd button thePart at 215,269
  130.     add 1 to partsVisible
  131.   else
  132.     put "Roll Again" into bkgnd field 1
  133.     show bkgnd field 1
  134.     wait 1 seconds
  135.     hide bkgnd field 1
  136.   end if
  137. end mouseUp
  138.  
  139. ** BKGND #1, BUTTON #2: What Do I Do Now? ************************************
  140. on mouseUp
  141.   push card
  142.   visual iris open
  143.   go to card "potatoHelp"
  144. end mouseUp
  145.  
  146. ** BKGND #1, BUTTON #3: Go Home ************************************
  147. on mouseUp
  148.   visual dissolve to black
  149.   visual dissolve to white
  150.   doMenu "Home"
  151. end mouseUp
  152.  
  153. ** BKGND #1, BUTTON #10: newGame ************************************
  154. on mouseUp
  155.   hide bkgnd field "youWin!"
  156.   newGame
  157. end mouseUp
  158.  
  159. ** BKGND #1, BUTTON #11 ************************************
  160. on mouseUp
  161.   show bkgnd button "mouth"
  162.   show bkgnd button "nose"
  163.   show bkgnd button "leftEye"
  164.   show bkgnd button "leftEar"
  165.   show bkgnd button "rightEye"
  166.   show bkgnd button "rightEar"
  167. end mouseUp
  168.  
  169. ** BKGND #1, BUTTON #12 ************************************
  170. on mouseDown
  171.   put empty into bkgnd field 2
  172.   show bkgnd field 2
  173.   put "Bill Robertson" into line 1 of bkgnd field 2
  174.   put "microPRINT" into line 2 of bkgnd field 2
  175.   put "214 Third Avenue" into line 3 of bkgnd field 2
  176.   put "Waltham, MA   02154" into line 4 of bkgnd field 2
  177.   put "GEnie:BILLR" into line 6 of bkgnd field 2
  178.   wait 2 seconds
  179. end mouseDown
  180.  
  181. on mouseUp
  182.   hide bkgnd field 2
  183. end mouseUp
  184.  
  185. ** CARD #13, FIELD #1 ************************************
  186. on mouseUp
  187.   hide card button "Got It!"
  188.   hide card field 1
  189.   visual dissolve to black
  190.   go to this card
  191.   show card field 2
  192. end mouseUp 
  193. ** CARD #13, FIELD #2:   ************************************
  194. on mouseUp
  195.   hide card field 2
  196.   visual dissolve to black
  197.   go to this card
  198.   show card field 3
  199.   show card button 2
  200. end mouseUp
  201.  
  202. ** CARD #13, FIELD #3:   ************************************
  203. on openField
  204.   show card button 1
  205. end openField
  206.  
  207. on mouseUp
  208.   hide card button 2
  209.   hide card field 3
  210.   visual dissolve to black
  211.   go to this card
  212.   show card field 1
  213.   show card button "Got It!"
  214. end mouseUp
  215.  
  216.  
  217.  
  218. ** CARD #13, BUTTON #1: Got it! ************************************
  219. on mouseUp
  220.   visual iris close
  221.   pop card
  222. end mouseUp
  223.  
  224. ** CARD #13, BUTTON #2: Look at my script  ************************************
  225. on mouseUp
  226.   choose button tool
  227.   doMenu "New Button"
  228.   set hilite of card button "New Button" to true
  229.   set textAlign of card button "new Button" to left
  230.   set textAlign of card button "new Button" to right
  231.   set textAlign of card button "new Button" to left
  232.   set textAlign of card button "new Button" to right
  233.   set textSize of card button "new Button" to 9
  234.   set textAlign of card button "new Button" to left
  235.   set textAlign of card button "new Button" to right
  236.   set textAlign of card button "new Button" to left
  237.   set textAlign of card button "new Button" to right
  238.   wait 1 seconds
  239.   click at the loc of card button "New Button"
  240.   doMenu "Clear Button"
  241.   choose browse tool
  242. end mouseUp
  243.  
  244.